# A basic CI script to automate publishing @ngx-dummy/accordion-simple lib
name: ghp-deploy
on:
  release:
    types: [created, published]
  push:
    tags:
      - 'v*' # Push events to matching v*, i.e. v1.0, v2.0.1

jobs:
  build:
    if: startsWith(github.repository_owner, 'ngx')
    runs-on: ubuntu-latest

    name: Deploying package to github packages registry
    steps:
      - uses: actions/checkout@v3
      # Setup .npmrc file to publish to npm
      - uses: actions/setup-node@v3
        with:
          node-version: '16.x'
          registry-url: 'https://npm.pkg.github.com'
          scope: '@ngx-dummy'
      - run: |
          echo Installing..!
          npm install -g @angular/cli > /dev/null
          npm ci
          npm run build:prod --if-present
      - run: npm run ci:publish:full --if-present
        env:
          NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
